﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace PICOC.Test
{
    [TestClass]
    public class BasicQueryStringTest
    {

        [TestMethod]
        public void should_generate_and_empty_query_when_tho_terms()
        {
            PICOCStructure structure = new PICOCStructure();

            String query = structure.CreateQuery();

            Assert.AreEqual(String.Empty, query);
        }

        [TestMethod]
        public void should_work_with_1_term()
        {
            PICOCStructure structure = new PICOCStructure(new PICOCElement("Hello World"));

            String query = structure.CreateQuery();

            Assert.AreEqual("(\"Hello World\")", query);
        }

        [TestMethod]
        public void should_generate_the_correct_query()
        {
            PICOCElement population = new PICOCElement("Web Authentication");
            PICOCElement intervention = new PICOCElement("Semantic Web");
            PICOCElement context = new PICOCElement("Cloud Computing");
            PICOCElement outcome = new PICOCElement("Solutions");

            PICOCStructure structure = new PICOCStructure(population, intervention, context, outcome);

            String query = structure.CreateQuery();

            Assert.AreEqual("(\"Web Authentication\") AND (\"Semantic Web\") AND (\"Cloud Computing\") AND (\"Solutions\")", query);
        }

    }
}
